package org.example.cake.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.cake.entity.Paycakeid;

import java.util.List;

@Mapper
public interface PaycakeidMapper {
    /**
     * 把订单里的蛋糕添加到这个表中
     * @Date 2025-08-01 谭丽娜
     * @param paycakeid
     * @return
     */
    @Insert("insert into paycakeid(cakeid,payid,cakesize) values (#{paycakeid.cakeid},#{paycakeid.payid},#{paycakeid.cakesize})")
    Integer insertAddcakeid(@Param("paycakeid") Paycakeid paycakeid);
    /**
     * 查询订单蛋糕总数
     * @param paycakeid
     * @return
     */
    @Select("select COUNT(*) from paycakeid where payid=#{paycakeid.payid} ")
    Integer selectpaycount(@Param("paycakeid") Paycakeid paycakeid);

    /**
     * 获取蛋糕id
     * @Date 2025-08-04 谭丽那
     * @param payid
     * @return
     */
    @Select("select cakeid from paycakeid where payid=#{payid}")
    List<Integer> selectByckaeid(@Param("payid") Integer payid);
    /**
     * 根据payid查询蛋糕总数
     * @param payid
     * @return
     */
    @Select("select COUNT(*) from paycakeid where  payid=#{payid} ")
    Integer getcakecount(Integer payid);
}
